<div id="bidsPage">
    <div class="post">
        <h2 class="title">Bids</h2>
        <div class="entry">
            <script>
                $(function() {
                    $( "#bid_datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' });
                });
            </script>


            <input type="button" value="Add new" onclick="show('#new_bid')"/>


            <?php
        //    if ($this->session->userdata("admin")) {
            ?>
                <input type="button" value="Search" onclick="show('#searchBids')"/>
                <input type="button" value="Clear Search" onclick="clearSearch()"/>
            <?php
        //    }
            ?>

            <div id="bids_result" class="info">
                <?= $message ?>
            </div>
            <script type="text/javascript">
                function searchBids(){
                    field=document.getElementById("searchBidsForm").field.value;
                    search=document.getElementById("searchBidsForm").search.value;
                    $("#bidsPage").load("<?= base_url(); ?>index.php?/admin_mis/bids/"+field+"/"+search);
                }
                function clearSearch(){
                    $("#bidsPage").load("<?= base_url(); ?>index.php?/admin_mis/bids/");
                }
            </script>

            <div id="bid_result" style="display: none">
            </div>
            <!--a href="" id="hide3" >Hide</a> <a href="" id="show3" >Show</a-->
            <div id="new_bid" style="display: none;margin-bottom: 10px;">
                <?php $data['id'] = "bid_form" ?>
                <?= form_open_multipart('mis/saveBid', $data); ?>
                <table>
                        <tr class="darker"><td class="half">Bid No.</td><td><input type="text" class="wide" name="bid_no" value="<?php echo set_value('bid_no'); ?>"  /></td> </tr>
                        <tr  class="lighter"><td>Name Of Company Bidding</td><td><input type="text"  class="wide" name="company" value="<?php echo set_value('company'); ?>" /></td> </tr>
                        <tr class="darker"><td>Where advertised</td><td><input type="text" class="wide"  name="where_advertised" value="<?php echo set_value('date_advertised'); ?>"/></td> </tr>
                        <tr class="lighter"><td>Date Advertised</td><td><input type="text" class="wide"  name="date_advertised" value="<?php echo set_value('date_advertised'); ?>" id="bid_datepicker" /></td> </tr>
                        <tr  class="darker"><td>Offer Description (Max. 1000 words)</td><td><textarea  class="wide" name="description" rows="7"><?php echo set_value('description'); ?></textarea> </td> </tr>
                        <tr  class="lighter"><td>Bid Offer Cost</td><td><input type="text"  class="wide" name="cost" value="<?php echo set_value('cost'); ?>" /></td> </tr>

                        <tr><td colspan="2" style="text-align: right">
                                <input type="submit" value="Submit" />
                                <input type="button" value="Cancel" onclick="hide('#new_bid')"/>
                            </td></tr>
                    </table>
                    </form>
                </div>



                <div id="searchBids" style="display: none;margin-bottom: 10px;">
                    <form id="searchBidsForm">
                        <table>
                            <tr class="darker"><td class="half">Select search criteria</td>
                                <td><select name="field">
                                        <option value='all'>All</option>
                                        <option value='bid_no'>Bid no</option>
                                        <option value='company'>Name of company</option>
                                        <option value='where_advertised'>Where advertised</option>
                                        <option value='description'>Offer description</option>
                                        <option value='added_by'> Added by</option>
                                    </select></td>
                                <td><input type="text" name="search" class="wide"  value="<?php echo set_value('added_by'); ?>" /></td>
                            </tr>

                            <tr><td colspan="3" style="text-align: right">
                                    <input type="button" value="Submit" onclick="searchBids()" />
                                    <input type="button" value="Cancel" onclick="hide('#searchBids')"/>
                                </td></tr>

                        </table>
                    </form>
                </div>
                <div id="all_bid">
                <?= $tablet ?>
                <?= $pagina ?>
            </div>

        </div>
    </div>
</div>